program InsertionSort;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  arr : array of integer;
  i, max, t, n, j : Integer;




begin
  Readln (n);
  SetLength (arr, n);
  Randomize;
  for i := 0 to n-1 do
  begin
    arr[i] := Random (n);
    write (arr[i], ' ');
  end;
  readln;

    for i := 0 to n-1 do
    begin
      t := arr[i];
      j := i ;
      while ((j > 0) and (arr[j-1] > t)) do
      begin
        arr[j] := arr[j-1] ;
        j := j - 1           ;
      end;
      arr[j] := t;
    end;



   for i := 0 to n-1 do
     write (arr[i], ' ');
     Readln;


end.